package ui.home.column1

import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import ui.compose.NetworkImage
import ui.home.HomeViewModel


/**
 * @author wei kunJie
 * @date 2024/3/11 13:27:12
 */
@Composable
fun Head(url:MutableState<String>) {
    //加载网络图片:用户头像
    NetworkImage(
        url = url.value,
        painterFor = { remember { BitmapPainter(it) } },
        contentDescription = "头像",
        modifier = Modifier.size(40.dp).clip(CircleShape),
        contentScale = ContentScale.Crop,
        defaultPainterFor = painterResource("image/default_head.png")
    )
}
